package com.lg.concurrent.schedule;

import java.util.concurrent.TimeUnit;

/**
 * 父等子停
 */
public class JoinTest {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(() -> {
            System.out.println(Thread.currentThread().getName() + " start");
            try {
                TimeUnit.SECONDS.sleep(3);
            } catch (InterruptedException e) {


            }
            System.out.println(Thread.currentThread().getName() + " end");
        });

        System.out.println(Thread.currentThread().getName() + " start");
        thread.start();
        thread.join();
        System.out.println(Thread.currentThread().getName() + " end");
    }
}
